<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="avicit.platform6.core.locale.PlatformLocalesJSTL"%>
<%@page import="java.util.Locale"%>
<%@page import="avicit.platform6.api.session.SessionHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ page import="avicit.platform6.commons.utils.ViewUtil"%>
<%@page import="avicit.platform6.api.sysshirolog.impl.AfterLoginSessionProcess"%>
<%
    Object lang=session.getAttribute(AfterLoginSessionProcess.SESSION_CURRENT_LANGUAGE_CODE);
    String languageCode="zh_CN";
    if(lang!=null){
        languageCode=lang.toString();
    }
    Locale locale =SessionHelper.getLocaleByUser(request);
%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>导入结构数据</title>
    <base href="<%=ViewUtil.getRequestPath(request)%>">
    <jsp:include
            page="/avicit/platform6/component/common/EasyUIJsInclude.jsp"></jsp:include>
    <jsp:include page="/avicit/im/common/ImUIJSCSSInclude.jsp"></jsp:include>
    <%
        String sysId = request.getParameter("sysId");
        String templetId = request.getParameter("templetId");
        String dialogId = request.getParameter("dialogId");
    %>
    <script type="text/javascript"
            src="avicit/cbb/techclass/tabledefine/commtempletmanager/locale/language_<%=languageCode%>.js"></script>
    <script type="text/javascript">
        var baseurl = "<%=ViewUtil.getRequestPath(request)%>";
        var sysId = "";
        var nodeId = "";
        var dialogId = "";
        var templetId = "";
        $(function(){
            sysId = "<%=sysId%>";
            templetId = "<%=templetId%>";
            dialogId = "<%=dialogId%>";
        });
        /***
         * 导入数据
         */
        function importData() {
            var filePath = document.getElementById("file").value;
            if (filePath == "") {
                //commonLang.tip.alert替换'提示',commonLang.tip.alert11 替换'请选择文件！'
                $.messager.alert(commonLang.tip.alert, commonLang.tip.alert11, 'warning');
            } else {
                var excelValue = filePath.substring(filePath.lastIndexOf('.'))
                    .toLowerCase();
                if (excelValue == ".xlsx" || excelValue == ".xls") {
                    document.getElementById("importForm").action = 'platform/aos/commtempletmanagerController/importData?sysId='
                        + sysId
                        + '&templetId='
                        + templetId
                        + '&dialogId='
                        + dialogId;
                    document.getElementById("importForm").submit();
                } else {
                    //commonLang.tip.alert替换'提示',commonLang.tip.alert12替换'请选择需要导入的Excel数据！'
                    $.messager.alert(commonLang.tip.alert, commonLang.tip.alert12, 'warning');
                }
            }
        }

        function closeForm() {
            if (parent != null && parent.$('#' + dialogId) != null) {
                parent.reloadTempletInfo();
                parent.$('#' + dialogId).dialog('close');
            }
        }
    </script>
</head>
<body class="easyui-layout" fit="true">
<div data-options="region:'center',split:true,border:false">
    <form id="importForm" method="post" enctype="multipart/form-data">
        <%-- Excel文件选择 --%>
        <div style="padding-left: 10px; padding-top: 5px">
            <%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.referenceTemplateDefine.basicFieldTable.button.importConstructionData.ExcelFileSelect","i18n.lantop",locale)%>：<input type="file" style="width: 300px; height: 25px;"
                                                                                                                                                                                                 name="file" id="file"></input> <br /> <span style="color: red">${requestScope.message }</span>
        </div>
    </form>
</div>
<div data-options="region:'south',border:false" style="height: 40px;">
    <div id="toolbar"
         class="datagrid-toolbar datagrid-toolbar-extend foot-formopera">
        <table class="tableForm" border="0" cellspacing="1" width="100%">
            <tr>
                <td align="right"><sec:accesscontrollist hasPermission="3"
                                                         domainObject="commtempletmanager_table_node_record_set_config_btn_importButton">
                    <%-- 上传 --%>
                    <a id="saveButton" class="easyui-linkbutton primary-btn"
                       onclick="importData();" href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.referenceTemplateDefine.basicFieldTable.button.importConstructionData.button.upload","i18n.lantop",locale)%></a>
                </sec:accesscontrollist> <sec:accesscontrollist hasPermission="3"
                                                                domainObject="commtempletmanager_table_node_record_set_config_btn_cancelButton">
                    <%-- 返回 --%>
                    <a id="canceButton" class="easyui-linkbutton"
                       onclick="closeForm();" href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.referenceTemplateDefine.basicFieldTable.button.importConstructionData.button.return","i18n.lantop",locale)%></a>
                </sec:accesscontrollist></td>
            </tr>
        </table>
    </div>
</div>
</body>
</html>